<?php
require_once( '../system/loginauth.inc.php' );
session_name( 'AOKI_ADMIN' );
session_start();

if( !isset($_SESSION['ADMIN_LOGIN']['STAFF_ID']) ){
	header("Location: ./login.php");
	exit;
}
$login['autoid']     = $_SESSION['ADMIN_LOGIN']['STAFF_SEQ'];
$login['staff_id']   = $_SESSION['ADMIN_LOGIN']['STAFF_ID'];
$login['staff_name'] = $_SESSION['ADMIN_LOGIN']['STAFF_NAME'];
$login['staff_auth'] = $_SESSION['ADMIN_LOGIN']['STAFF_AUTH'];

$smarty->assign('login', $login );

$aoki_auth = $_SESSION['ADMIN_LOGIN']['STAFF_AUTH_ARR'];

$aokimenu=array(
	  AOKI_AUTH_USER => array("name" => "ログインマスタ","class" => "menu001" ,
	   "li" =>array(
	   	"user_index"  => array("name" => "ユーザ情報一覧"),
	   	"user_form"   => array("name" => "ユーザ情報登録"),
	   	"user_import" => array("name" => "CSV更新")
	   )),
	  AOKI_AUTH_SHOP => array("name" => "店舗マスタ","class" => "menu003" ,
	   "li" =>array(
	   	"mshop_index"  => array("name" => "店舗情報一覧"),
	   	"mshop_form"   => array("name" => "店舗情報登録"),
	   	"mshop_import" => array("name" => "CSV更新")
	   )),
	  AOKI_AUTH_INS_SHOP => array("name" => "折込販売店マスタ","class" => "menu002" ,
	   "li" =>array(
	   	"minsshop_index"     => array("name" => "折込販売店情報一覧"),
	   	"minsshop_form"      => array("name" => "折込販売店情報登録"),
	   	"minsshop_import"    => array("name" => "CSV更新"),
	   	"mins_delive_index"  => array("name" => "納品先マスタ")
	   )),
	   AOKI_AUTH_INS_SHOP_SHOP => array("name" => "販売店紐付けマスタ","class" => "menu009" ,
	   "li" =>array(
	   	"minsshopshop_index"  => array("name" => "販売店紐付け情報一覧"),
	   //	"minsshopshop_form"   => array("name" => "販売店紐付け情報登録")
	   )),
	   AOKI_AUTH_PATTERN => array("name" => "パターンマスタ","class" => "menu005" ,
	   "li" =>array(
	   	"mpattern_index"  => array("name" => "パターン一覧"),
	   	"mpattern_form"   => array("name" => "パターン登録")
	   )),
	   AOKI_AUTH_MATRIX => array("name" => "マトリックスマスタ","class" => "menu004" ,
	   "li" =>array(
	   	"mmatrix_index"  => array("name" => "マトリックス情報一覧"),
	   	"mmatrix_form"   => array("name" => "マトリックス情報登録")	  
	   )),
	   AOKI_AUTH_MAP_GROUP => array("name" => "マップグループマスタ","class" => "menu007" ,
	   "li" =>array(
	   	"mmapg_index"      => array("name"  => "マップ情報一覧"),
	   	"mmapshop_index"   => array("name"  => "マップ情報更新"),
	   	"mmapshop_import"  => array("name"  => "CSV更新"),
	   	"mmservice_index"  => array("name"  => "サービスマップマスタ")
	   )),
	   AOKI_AUTH_MON_CELL => array( "name" => "印刷手配管理","class" => "menu012" ,
	   "li" =>array(
	   	"tmoncell_index"      => array( "name" => "月間セール明細情報一覧" ),
	   	"tmoncell_form"       => array( "name" => "月間セール明細情報登録" ),
	   	"tmoncell_update"     => array( "name" => "月間セール明細更新" ),
	   	"tmoncellprn_index"   => array( "name" => "印刷部数明細" ),
	   	"tmoncellshop_index"  => array( "name" => "店舗実施一覧表" )
	   )),
	   AOKI_AUTH_DNP_AREA => array("name" => "地域広告マスタ","class" => "menu006" ,
	   "li" =>array(
	   	"ddnpwarea_index"  => array("name" => "地域広告情報一覧.更新"),
	   	"ddnpwarea_update"   => array("name" => "地域広告情報登録"),
	   	"ddnparea_index"    => array("name" => "DNPエリアマスタ")
	   )),
	   AOKI_AUTH_T_PATTERN => array("name" => "パターン管理","class" => "menu011" ,
	   "li" =>array(
	   	"tpattern_index"      => array("name" => "店別配布明細検索.更新"),
	   	"tpattern_copy"       => array("name" => "店別配布明細登録"),
	   	"tpattern_export"     => array("name" => "店別配布明細出力"),
	   	"tpattern_shop"       => array("name" => "店別パターン部数"),
	   	"tpattern_delive"     => array("name" => "分納明細出力")
	   )),
	   
	   AOKI_AUTH_NEWYEAR => array("name" => "年末年始サマリマスタ","class" => "menu008" ,
	   "li" =>array(
	   	"mnewyear_index"     => array("name" => "年末年始サマリ情報一覧"),
	   	"mnewyear_form"      => array("name" => "年末年始サマリ情報登録"),
	   	"mnewyear_week_form" => array("name" => "週名設定"),
	   )),
	///   AOKI_AUTH_AJAREKS => array("name" => "AJAREKS紐付けマスタ","class" => "menu010" ,
	 //  "li" =>array(
	 //  	"majareks_index"  => array("name" => "AJAREKS紐付け一覧"),
	 //  	"majareks_import" => array("name" =>  "CSV更新")
	 //  )),
	   AOKI_AUTH_AFCS => array("name" => "チラシ情報サイト","class" => "menu013" ,
	   "li" =>array(
	   	"afcs_index"  =>array("name" =>  "チラシ情報サイト")
	   )),
	   AOKI_AUTH_COST_QR => array("name" => "チラシ経費管理","class" => "menu016" ,
	   "li" =>array(
	   	"mcost_flier_index"   => array("name" => "経費一覧.更新"),
	   	"mcost_flier_import"  => array("name" => "経費一括登録"),
	    "mcost_flier_price"   => array("name" => "チラシ単価マスタ")
	   )),
	   AOKI_AUTH_COST_DM => array("name" => "DM経費管理","class" => "menu016" ,
	   "li" =>array(
	   	"mcost_dm_index"          => array("name" => "登録情報一覧.更新"),
	   	"mcost_dm_d_import"       => array("name" => "明細表登録"),
	    "mcost_dm_c_import"       => array("name" => "件数表登録"),
	   	"mcost_dm_price"          => array("name" => "DM単価マスタ"),
	   	"mcost_dm_plane_index"    => array("name" => "経費一覧.更新"),
	   	"mcost_dm_plane_import"   => array("name" => "経費一括登録")
	   )),
	   AOKI_AUTH_COST => array("name" => "経費出力一覧","class" => "menu016" ,
	   "li" =>array(
	   	"mcost_list_index"          => array("name" => "経費・予実比一覧 "),
	   	"mcost_list_month_index"    => array("name" => "月別集計"),
	    "mcost_list_sum_index"      => array("name" => "累計一覧"),
	    "mcost_list_quantity_index" => array("name" => "経準高管理"),
	   	"mcost_list_quantity_import"=> array("name" => "経準高計画一括登録"),
	   	"mcost_list_quantity_import"=> array("name" => "経準高計画一括登録"),
	   )),

	   AOKI_AUTH_RHIZOME => array("name" => "リゾームマスタ","class" => "menu015" ,
	   "li" =>array(
	   	"mrhizome_index"  => array("name" => "リゾーム履歴")
	   )),
	   );
		foreach ($aokimenu as $k =>$v ) {
			if ( isset( $aoki_auth[$k] ) ) {
				$aokimenu[$k]["auth"] = TRUE;
			} else {
				$aokimenu[$k]["auth"] = false;
			}
			
			foreach ($v["li"] as $kk =>$vv ) {
				if ( isset( $aoki_auth[$kk] ) ) {
					$aokimenu[$k]["li"][$kk]["auth"] = TRUE;
				} else {
					$aokimenu[$k]["li"][$kk]["auth"] = false;
				}
			}
		}
		

$smarty->assign( 'aokimenu', $aokimenu );

// 権限マスタ
/*
0 管理者
1 AOKI管理者
2 エリアAJA
3 ゾーンAJA
4 折込会社(通常)
5 折込会社(地域広告)
6 印刷会社(大日本)
7 印刷会社(佐川印刷)
8 一般店舗
*/
$arr_auth = array(
	'0'  => 'G-0 管理者',
	'1'  => 'G-1 AOKI管理者',
	'2'  => 'G-2 エリアAJA',
	'3'  => 'G-3 ゾーンAJA',
	'4'  => 'G-4 折込会社(通常)',
	'5'  => 'G-5 折込会社(地域広告)',
	'7'  => 'G-7 印刷会社(佐川印刷)',
	'8'  => 'G-8 一般店舗'
);

// 

?>